#include "MemBlock.h"

#define WIDTH	1000
#define	HEIGHT	100

MemBlock::MemBlock(QWidget* parent) : QWidget(parent)
{
	setBackgroundRole(QPalette::Base);
	setAutoFillBackground(true);
}

QSize MemBlock::minimumSizeHint() const
{
	return QSize(WIDTH, HEIGHT);
}

QSize MemBlock::sizeHint() const
{
	return QSize(WIDTH, HEIGHT);
}

void MemBlock::AddNode(int nBase, int nLim, int nPID)
{
	m_nPID = nPID;
	rectNode.setRect(nBase, 0, nLim, HEIGHT); 	
	update();	
}

void MemBlock::paintEvent(QPaintEvent* /*event*/)
{
	QPainter painter(this);

	painter.setPen(QColor(255, 0, 0));
	painter.setBrush(QColor(255, 0, 0));
	
	painter.save();
	painter.drawRect(rectNode);
	painter.restore();
}
